package tk.jfree.example.gridfs.service;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.gridfs.GridFsResource;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author Cheng.Wei
 * @date 2019/09/23 11:57
 */
public interface FileService {
    /**
     * 保存
     * @param file
     * @return
     * @throws IOException
     */
    ObjectId save(MultipartFile file) throws IOException;

    /**
     * 读取
     * @param id
     * @return
     */
    GridFsResource get(String id);

    /**
     * 删除
     * @param id
     */
    void delete(String id);

}
